package text;

import java.util.ArrayList;

public class text {
    public static void main(String[] args) {
        ArrayList<User>list=new ArrayList<User>();
        User u1=new User("heima001","小方",123456);
        User u2=new User("heima002","小明",1234567);
        User u3=new User("heima003","小张",123456789);
        list.add(u1);
        list.add(u2);
        list.add(u3);
        int A= B1(list,"heima010");
        System.out.println(A);

    }
    public static int B1(ArrayList<User>list,String ID){
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getID().equals(ID)){
                return i;
            }
        }return -1;



    }

}
